package com.xca.znb.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class FeedbackDBHelper extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "feedback.db" ;
    private static final int DATABASE_VERSION = 1 ;

    public static final String TABLE_FEEDBACK = "feedback";
    public static final String FEEDBACK_ID = "id" ;
    public static final String FEEDBACK_TEXT = "text" ;
    public static final String FEEDBACK_IMG_LIST = "img_list" ;
    public static final String FEEDBACK_PUBLISHER = "publisher" ;

    private static final String CREATE_TABLE_FEEDBACK = "CREATE TABLE " + TABLE_FEEDBACK + " ( " +
            FEEDBACK_ID + " INTEGER PRIMARY KEY AUTOINCREMENT , " +
            FEEDBACK_TEXT + " TEXT , " +
            FEEDBACK_IMG_LIST + " TEXT , " +
            FEEDBACK_PUBLISHER + " TEXT ) " ;

    public FeedbackDBHelper(@Nullable Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_FEEDBACK);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_FEEDBACK);
        onCreate(db);
    }
}
